#!/bin/bash
#
##################################
#                                #
#  David Lladro - S2 Grupo       #
#     Noviembre 2011             #
#  Mail: david.lladro@gmail.com  #
#  Twitter: @davidlladro         #
#                                #
##################################
#
# Remote David Hasselhoff attack
# 
# If you gain root on a desktop machine, yo can change the wallpaper to this awesome pic in
# one single command.
# su user; chmod +x hoff.sh; ./hoff.sh
#

# Get the pid of nautilus
nautilus_pid=$(pgrep -u $LOGNAME -n nautilus)

# If nautilus isn't running, just exit silently
if [ -z "$nautilus_pid" ]; then
exit 0
fi

# Grab the DBUS_SESSION_BUS_ADDRESS variable from nautilus's environment
eval $(tr '\0' '\n' < /proc/$nautilus_pid/environ | grep '^DBUS_SESSION_BUS_ADDRESS=')

# Check that we actually found it
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
echo "Failed to find bus address" >&2
exit 1
fi

# export it so that child processes will inherit it
export DBUS_SESSION_BUS_ADDRESS

#script to randomly set Background from files in a directory

wget http://x90.es/1gf
sleep 5
gconftool-2 -t str -s /desktop/gnome/background/picture_filename $HOME/1gf
